﻿using System.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel;

namespace Launch.ViewModel;

public partial class TestPropertyVm : ObservableObject
{
    // 选中的对象
    [ObservableProperty] private object _mySelectedObject;
}

public class Person : ObservableObject
{
    private string _name = "张三";

    [Category("基本信息")]
    [DisplayName("姓名")]
    [Description("人员的全名")]
    public string Name
    {
        get => _name;
        set => SetProperty(ref _name, value);
    }

    [Category("基本信息")] [DisplayName("年龄")] public int Age { get; set; } = 25;

    [Category("联系信息")]
    [DisplayName("电子邮箱")]
    public string Email { get; set; } = "zhangsan@example.com";

    [Category("联系信息")]
    [DisplayName("电话号码")]
    public string Phone { get; set; } = "13800138000";

    [Browsable(false)] // 隐藏该属性
    public string InternalId { get; set; } = "12345";
}

public enum ProductName
{
    产品A,
    产品B,
    产品C
}

public class Product
{
    [Category("产品信息")]
    [DisplayName("产品名称")]
    public ProductName ProductName { get; set; }

    [Category("产品信息")]
    [DisplayName("价格")]
    [Description("产品售价")]
    public decimal Price { get; set; }

    [Category("库存信息")]
    [DisplayName("库存数量")]
    public int StockQuantity { get; set; } = 100;
}

public class Settings
{
    [Category("界面设置")] [DisplayName("主题")] public string Theme { get; set; } = "Light";

    [Category("界面设置")] [DisplayName("语言")] public string Language { get; set; } = "中文";

    [Category("系统设置")]
    [DisplayName("自动保存")]
    public bool AutoSave { get; set; } = true;
}